<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <title>RatePlan List</title>
    <link type="text/css" href="${contextPath}/static/style/global.css" rel="stylesheet"/>
    <script type="text/javascript" src="${contextPath}/static/script/jquery/jquery-1.4.2.js"></script>
    <script type="text/javascript">
        function delete_rate_plan(obj) {
            var ratePlanCode = obj.parent().parent().children("input:hidden").eq(0).val();
            var url = "./delRatePlan.dhtml?ratePlanCode=" + ratePlanCode;
        }
        function edit_rate_plan(obj) {

        }
    </script>
</head>
<body>
<div class="box_side" align="right">
    <a style="font-weight: bold;" href="empty.dhtml">Add RatePlan</a>
</div>
<div class="main">
    <form id="rate_plan_list_form">
        <table class="table_list" cellpadding="0" cellspacing="0">
            <thead>
            <tr>
                <th rowspan="2">Code</th>
                <th rowspan="2">Name</th>
                <th colspan="4">FreeMeal</th>
                <th rowspan="2">Guarantee</th>
                <th rowspan="2">PaymentType</th>
                <th rowspan="2">Operate</th>
            </tr>
            <tr>
                <th>Type</th>
                <th>Unit</th>
                <th>Quantity</th>
                <th>Description</th>
            </tr>
            </thead>
            <tbody>
            <s:iterator value="ratePlans" id="rtPlan" status="one">
            <tr <s:if test="#one.index%2==0"> class="even" </s:if>
                    <s:else>class="odd"</s:else>>
                <input type="hidden" value="${rtPlan.code}">
                <td><s:property value="#rtPlan.code"/></td>
                <td><s:property value="#rtPlan.name"/></td>
                <td><s:property value="#rtPlan.freeMeal.type"/></td>
                <td><s:property value="#rtPlan.freeMeal.unit"/></td>
                <td><s:property value="#rtPlan.freeMeal.quantity"/></td>
                <td><s:property value="#rtPlan.freeMeal.description"/></td>
                <td><s:if test="#rtPlan.needGuarantee">Yes</s:if><s:else>No</s:else></td>
                <td><s:property value="#rtPlan.paymentType"/></td>
                <td>
                    <a href="./view.dhtml?ratePlanCode=${rtPlan.code}">Edit</a>&nbsp;
                    <a href="./delete.dhtml?ratePlanCode=${rtPlan.code}">Delete</a>
            </tr>
            </s:iterator>
            <tbody>
        </table>
    </form>
</div>
</body>
</html>